<template>
  <main-layout
    title="采购详情页"
    :showBack="isHome"
    :showHome="!isHome"
    :showNew="true"
  >
  <div v-for="it in detail" :key="it.key">
    {{it.label}}:{{it.value}}
  </div>
   <van-steps direction="vertical"  active-color="#07c163" :active="remark.length">
   <van-step v-for="it in remark"  :key="it.time">
    <h4>{{it.userName}}</h4>
    <h5>{{it.remark}}</h5>
    <p>{{it.time | fliter}}</p>
   
  </van-step>
</van-steps>
  </main-layout>
</template>
<script>
import {purchaseInfo} from '../../apis/purch'
import dateFormate from '../../util'
export default {
    data(){
        return{
            isHome:false,
                    list:[],
                    remark:[],
            detail:[{label:'项目名称',key:'projectName',value:''},
            {label:'供应商',key:'supplierName',value:''},
            {label:'联系人',key:'supplierContact',value:''},
            {label:'材料',key:'materialName',value:''},
            {label:'状态',key:'state',value:''}]
        }
    },
  async  created(){
        this.isHome=!!this.$route.query.from
        let result=await purchaseInfo(this.$route.query.id)
        console.log(result)
        if(result.code===200){
          for(let it of this.detail){
             it.value=result.data[it.key]
             
          }
          this.remark=result.data.remark.reverse()
          // this.remark.map(it=>it.time=dateFormate(it.time))
        }
       
    },
 methods:{

 }
  
}
</script>
<style lang="less" scoped>
h2{
  color: rgb(36, 37, 37);
}
div{
  padding: 5px 10px;
  color: rgb(66, 66, 66);
  font-size: .85rem;
  >p{
    font-size: .7rem;
  }
}
</style>